<template>
  <div class="biaoge">
        <div class="operate_inputs">
            <el-form :inline="true" :model="formInline" class="demo-form-inline">
                <el-form-item label="手机号:">
                    <el-input class='smbtn' v-model="formInline.username_kw"></el-input>
                </el-form-item>
                 <el-form-item label="学员姓名:">
                    <el-input class='smbtn' v-model="formInline.nickname_kw"></el-input>
                </el-form-item>
                <el-form-item label="所属状态:">
                    <el-select class='smbtn' v-model="formInline.status" filterable placeholder="全部">
                        <el-option v-for="(p,j) in status" :key='j' :label="p.attriname" :value="p.attriid"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item v-if='xxSelect' >
                    <el-select class='smbtn' v-model="formInline.agentid" filterable placeholder="线下校列表">
                        <el-option  v-for="(a,i) in agents" :key='i' :label="a.nickname" :value="a.userid"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button class="search_btn" type="primary" @click="getData(true)"><i class="el-icon-search"></i>查询</el-button>
                    <el-button class="reset_btn" type="primary" @click="clearSearch"><i class="el-icon-refresh"></i>清空查询</el-button>
                </el-form-item>
            </el-form>
        </div>
        <!-- v-loading="true" -->
        <!--  -->
        <el-table
            v-loading="loading2"
            element-loading-text="加载中..."
            :data="studentsData"
            stripe 
            size="mini"
            :highlight-current-row=true
            border resizable
            @row-click='sendStudentId'
            style="width: 100%"
            :height="tableHeight">
            <!-- :width="columWidth" -->
            <el-table-column label="注册时间" :align="align" >
                <template slot-scope="scope">{{scope.row.regdate | transData}} </template>
                <!-- <template slot-scope="scope">{{Number(scope.row.regdate) | dateForm}} </template> -->
            </el-table-column>
            <el-table-column label="学员账号" :align="align">
                <template slot-scope="scope">{{scope.row.username}}</template>
            </el-table-column>
            <el-table-column label="学员姓名" :align="align">
                <template slot-scope="scope">{{scope.row.fullname}}</template>
            </el-table-column>
            <el-table-column label="妈妈姓名" :align="align">
                <template slot-scope="scope">{{scope.row.memberchild ? scope.row.memberchild.mumname:''}}</template>
            </el-table-column>
            <el-table-column label="妈妈手机" :align="align">
                <template slot-scope="scope">{{scope.row.memberchild ? scope.row.memberchild.mummobile:''}}</template>
            </el-table-column>
            <el-table-column label="学员状态" :align="align">
                <template slot-scope="scope" v-if='scope.row.attrinfo'>{{scope.row.attrinfo.attriname}}</template>
            </el-table-column>
            <el-table-column label="录入人" :align="align">
                <template slot-scope="scope">{{scope.row.agentAddPersonName}}</template>
            </el-table-column>
            
            <el-table-column 
                :align="align"
                min-width="240"
                :data="studentsData"
                fixed="right"
                label="操作">
                <template slot-scope="scope">
                    <el-button
                        size="mini"
                        @click="getFile(scope.row.userid,scope.row.ischild)">档案</el-button>
                    <el-button
                        size="mini"
                         @click='addRecord(scope.row.userid)'>添加回访记录</el-button>
                    <el-button
                        size="mini"
                        type="info" plain
                        @click="handleEdit(scope.row.userid,scope.row.ischild)">编辑资料</el-button>
                    <el-button
                        size="mini" @click="accountInfoDialog(scope.row.userid,scope.row.username,scope.row)">账户</el-button>
                        
                </template>
            </el-table-column>
        </el-table>
        <!-- 编辑资料弹窗 -->
        <div>
            <el-dialog title="编辑少儿学员资料"  
                :append-to-body="true" 
                :close-on-click-modal=false 
                v-if="ifchild" :visible.sync="dialogFormVisible">
                <el-form :model="form">
                    <el-form-item label-width="80px">
                        <div class="member_info">学员信息</div>
                    </el-form-item>
                    <el-form-item label="登录账号：" :label-width="formLabelWidth">
                        <el-input v-model="form.username" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="登录密码：" placeholder="不填则不修改" :label-width="formLabelWidth">
                        <el-input type="password" v-model="form.new_pwd"></el-input>
                    </el-form-item>
                    <el-form-item label="注册时间：" :label-width="formLabelWidth">
                        <el-input v-model="form.regdate" disabled></el-input>
                    </el-form-item>
                        <el-form-item label="上次登陆时间：" :label-width="formLabelWidth">
                        <el-input v-model="form.lastdate" disabled></el-input>
                    </el-form-item>
                        <el-form-item label="登录次数：" :label-width="formLabelWidth">
                        <el-input v-model="form.loginnum" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="英文名：" :label-width="formLabelWidth">
                        <el-input v-model="form.nickname"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input v-model="form.mobile"></el-input>
                    </el-form-item>
                    <el-form-item label="中文名：" :label-width="formLabelWidth">
                        <el-input v-model="form.fullname"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="发送信息给学员：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.sendmail">
                            <el-radio label=1>是</el-radio>
                            <el-radio label=0>否</el-radio>
                        </el-radio-group>
                    </el-form-item> -->
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input v-model="form.wx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="QQ：" :label-width="formLabelWidth">
                        <el-input v-model="form.qq"></el-input>
                    </el-form-item>
                    <el-form-item label="SKype：" :label-width="formLabelWidth">
                        <el-input v-model="form.skypenum" ></el-input>
                    </el-form-item>
                    <el-form-item label="Email：" :label-width="formLabelWidth">
                        <el-input v-model="form.email"></el-input>
                    </el-form-item>
                    <el-form-item label="性别：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.gender">
                            <el-radio label=1>男</el-radio>
                            <el-radio label=0>女</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="出生日期：" :label-width="formLabelWidth">
                        <div class="block">
                            <el-date-picker
                            v-model="form.birthday"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期">
                            </el-date-picker>
                        </div>
                    </el-form-item>
                    <el-form-item label="喜欢的动画片或玩具：" :label-width="formLabelWidth">
                        <el-input v-model="form.toycartoon"></el-input>
                    </el-form-item>
                    <el-form-item label="所在年级：" :label-width="formLabelWidth">
                        <el-select v-model="form.shoolPeriod" @change='getPeriod' placeholder="选择学年" class="divided_3">
                            <el-option 
                            v-for="(sp,a) in childData.shoolperiod"
                            :key="a" :label="sp.attriname" 
                            :value="sp.attriid"></el-option>
                        </el-select>
                        <el-select v-model="form.grade" placeholder="选择年级" class="divided_3">
                            <el-option v-for="(gradeitem,gd) in grade_lists" :key='gd' :label="gradeitem" :value="gd"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="性格特点：" :label-width="formLabelWidth">
                        <el-select v-model="form.character" placeholder="选择性格">
                            <el-option 
                            v-for="(childcc,b) in childData.childcharacters"
                            :key="b" :label="childcc.attriname" :value="childcc.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="学员头像" :label-width="formLabelWidth">
                        <el-upload
                            :action='avatar_url'
                            :data='upLoadData'
                            name='files'
                            :limit=1  
                            v-model="form.avatar"
                            :on-success='uploadAvatar'
                            list-type="picture-card">
                            <i class="el-icon-plus"></i>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="礼品邮寄地址：" :label-width="formLabelWidth">
                        <el-cascader
                            size="large"
                            :options="options"
                            v-model="form.address"
                            @change="handleChange">
                        </el-cascader>
                        <el-input v-model="form.giftAddr" class="divided_200"></el-input>
                    </el-form-item>
                    <el-form-item :label-width="formLabelWidth" label="学习渠道：">
                        <el-checkbox-group v-model="form.studyfrom">
                            <el-checkbox 
                            v-for="(studyf,d) in childData.studyfrom"
                            :key="d" :label="studyf.attriid">{{studyf.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label-width="80px">
                        <div class="member_info">家庭信息</div>
                    </el-form-item>
                    <el-form-item label-width="80px">
                        <el-tag type="info">父亲信息</el-tag>
                    </el-form-item>
                    <el-form-item label="姓名：" :label-width="formLabelWidth">
                        <el-input v-model="form.dadname"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input v-model="form.dadmobile"></el-input>
                    </el-form-item>
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input v-model="form.dadwx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="年龄：" :label-width="formLabelWidth">
                        <el-input v-model="form.dadage"></el-input>
                    </el-form-item>
                    <el-form-item label="职业性质：" :label-width="formLabelWidth">
                        <el-select v-model="form.dadjobs" placeholder="选择父亲职业">
                            <el-option 
                            v-for="(dadjob,e) in childData.jobs"
                            :key="e" :label="dadjob.attriname" :value="dadjob.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="工作单位：" :label-width="formLabelWidth">
                        <el-input v-model="form.dad_workaddr"></el-input>
                    </el-form-item>
                    <el-form-item label-width="80px">
                        <el-tag type="info">母亲信息</el-tag>
                    </el-form-item>
                    <el-form-item label="姓名：" :label-width="formLabelWidth">
                        <el-input v-model="form.mumname"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input v-model="form.mummobile"></el-input>
                    </el-form-item>
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input v-model="form.mumwx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="年龄：" :label-width="formLabelWidth">
                        <el-input v-model="form.mumage"></el-input>
                    </el-form-item>
                    <el-form-item label="职业性质：" :label-width="formLabelWidth">
                        <el-select v-model="form.mumjob" placeholder="选择母亲职业">
                            <el-option 
                            v-for="(mumjob,f) in childData.jobs"
                            :key="f" :label="mumjob.attriname" :value="mumjob.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="工作单位：" :label-width="formLabelWidth">
                        <el-input v-model="form.mum_workaddr"></el-input>
                    </el-form-item>
                     <el-form-item label="家庭收入：" :label-width="formLabelWidth">
                        <el-select v-model="form.familyincome" placeholder="请选择">
                            <el-option 
                            v-for="(fain,g) in childData.familyincomes"
                            :key="g" :label="fain.attriname" :value="fain.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否已经开始学习英语：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.alreadystudy">
                            <el-radio label=1>是</el-radio>
                            <el-radio label=0>否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item v-if='form.alreadystudy==1?true:false' label="学习了多久（单位：月）：" :label-width="formLabelWidth">
                        <el-input v-model="form.studytime"></el-input>
                    </el-form-item>
                    <el-form-item v-if='form.alreadystudy==1?true:false' label="学习英语以哪种方式开始：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.stratway">
                            <el-radio 
                            v-for="(starw,h) in childData.startways"
                            :key="h" :label="starw.attriid">{{starw.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item v-if='form.alreadystudy==1?true:false' label="是否接触过外教课程：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.withforeign">
                            <el-radio label=1>是</el-radio>
                            <el-radio label=0>否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                     <el-form-item v-if='form.withforeign==1?true:false' label="学习了多久（单位：月）：" :label-width="formLabelWidth">
                        <el-input v-model="form.foreigntime"></el-input>
                    </el-form-item>
                    <el-form-item label="就读学校：" :label-width="formLabelWidth">
                        <el-input v-model="form.schoolname"></el-input>
                    </el-form-item>
                     <el-form-item v-if='form.alreadystudy==1?true:false' label="孩子在校的英语成绩排名：" :label-width="formLabelWidth">
                        <el-select v-model="form.englishrank" placeholder="选择排名">
                            <el-option 
                            v-for="(enrank,i) in childData.englishrank"
                            :key="i" :label="enrank.attriname" :value="enrank.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="孩子目前英语水平：" :label-width="formLabelWidth">
                        <el-select v-model="form.englishlevel" placeholder="请选择">
                            <el-option 
                            v-for="(enlevel,j) in childData.englislevel"
                            :key="j" :label="enlevel.attriname" :value="enlevel.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="对孩子学习英语的期望：" :label-width="formLabelWidth">
                        <el-checkbox-group v-model="form.expects">
                            <el-checkbox v-for="(expec,k) in childData.expects" :key="k" :label="expec.attriid" name="expects">{{expec.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                     <el-form-item label="更希望孩子提升哪些方面：" :label-width="formLabelWidth">
                        <el-checkbox-group v-model="form.improvefields">
                            <el-checkbox v-for="(impf,l) in childData.improvefields" :key="l" :label="impf.attriid" name="improvefields">{{impf.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="选择机构时首选考虑因素：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.considerfield">
                            <el-radio v-for="(consfi,m) in childData.considerfields" :key="m" :label="consfi.attriid">{{consfi.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="每周预计投入学习时间：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.weekTime">
                            <el-radio v-for="(weekt,n) in childData.weektime" :key="n" :label="weekt.attriid">{{weekt.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="适合孩子的上课时间：" :label-width="formLabelWidth">
                        <el-checkbox-group v-model="form.suitabletime">
                            <el-checkbox v-for="(suitt,o) in childData.suitabletime" :key="o" :label="suitt.attriid" name="suitabletime">{{suitt.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="每月孩子学习英语的预算：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.monthbudget">
                            <el-radio ref="ref" v-for="(monthb,p) in childData.monthbudget" :key="p" :label="monthb.attriid">{{monthb.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="希望完成课程时间：" :label-width="formLabelWidth">
                        <el-select v-model="form.finishtime" placeholder="选择时间">
                            <el-option v-for="(studyshi,q) in childData.studyshijian" :key="q" :label="studyshi.attriname" :value="studyshi.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预算：" :label-width="formLabelWidth">
                        <el-select v-model="form.budget" placeholder="选择预算">
                            <el-option v-for="(studymon,r) in childData.studymoney" :key="r" :label="studymon.attriname" :value="studymon.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="学习诉求：" :label-width="formLabelWidth">
                        <el-input v-model="form.appeal"></el-input>
                    </el-form-item>
                    <el-form-item label="第一次付费金额：" :label-width="formLabelWidth">
                        <el-input v-model="form.firstpay" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="老师寄语：" :label-width="formLabelWidth">
                        <el-input v-model="form.teachernote"></el-input>
                    </el-form-item>
                    <el-form-item label="学员状态：" :label-width="formLabelWidth">
                        <el-select v-model="form.status" placeholder="选择状态">
                            <el-option v-for="(membersta,s) in childData.memberStatusList" :key="s" 
                            :label="membersta.attriname" :value="membersta.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                
                <div slot="footer" class="dialog-footer">
                    <el-button class="dialog_close" @click="dialogFormVisible = false">取 消</el-button>
                    <el-button class="dialog_confirm" type="primary" @click="editChild">确 定</el-button>
                </div>
            </el-dialog>
           
            <el-dialog title="编辑成人学员信息"  :append-to-body="true"  :close-on-click-modal=false v-if="!ifchild" :visible.sync="dialogFormVisible">
                <el-form :model="form" >
                    <el-form-item label="登录账号：" :label-width="formLabelWidth">
                        <el-input v-model="form.username" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="英文名：" :label-width="formLabelWidth">
                        <el-input v-model="form.nickname" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="密码：" :label-width="formLabelWidth">
                        <el-input v-model="form.new_pwd" type="password" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="中文名：" :label-width="formLabelWidth">
                        <el-input v-model="form.fullname" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input v-model="form.mobile" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="Email：" :label-width="formLabelWidth">
                        <el-input v-model="form.email" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="性别：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.gender">
                            <el-radio label=1>男</el-radio>
                            <el-radio label=0>女</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="学员头像" :label-width="formLabelWidth">
                        <el-upload
                            :action='avatar_url'
                            :data='upLoadData'
                            name='files'
                            :limit=1  
                            :on-success='uploadAvatar'
                            v-model="form.face"
                            list-type="picture-card">
                            <i class="el-icon-plus"></i>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="礼品邮寄地址：" :label-width="formLabelWidth">
                        <el-cascader
                            size="large"
                            :options="options"
                            v-model="form.address"
                            @change="handleChange">
                        </el-cascader>
                    </el-form-item>
                    <el-form-item label="大学：" :label-width="formLabelWidth">
                        <el-input v-model="form.daxue" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="专业：" :label-width="formLabelWidth">
                        <el-input v-model="form.zhuanye" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="公司：" :label-width="formLabelWidth">
                        <el-input v-model="form.gongsi" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="行业：" placeholder="选择一项行业" :label-width="formLabelWidth">
                        <el-select v-model="form.job">
                            <el-option v-for="(jobitem,c) in fromLabel.job" :key="c" :label="jobitem.attriname" :value="jobitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="职位：" :label-width="formLabelWidth">
                        <el-input v-model="form.zhiwei" auto-complete="off"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="公司网站：" :label-width="formLabelWidth">
                        <el-input v-model="form.gongsiwangzhi" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="公司电话：" :label-width="formLabelWidth">
                        <el-input v-model="form.gongsidianhua" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="公司人事联系人：" :label-width="formLabelWidth">
                        <el-input v-model="form.lianxiren" class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input v-model="form.wx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="qq" :label-width="formLabelWidth">
                        <el-input v-model="form.qq" auto-complete="off"></el-input>
                    </el-form-item>  
                    <el-form-item label="SKype：" :label-width="formLabelWidth">
                        <el-input v-model="form.skypenum" auto-complete="off"></el-input>
                    </el-form-item>  
                    <el-form-item label="分类：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.isfirststudy">
                            <el-radio label=0>第一次学习</el-radio>
                            <el-radio label=1>上过体验课</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="年龄段：" placeholder="选取年龄段" :label-width="formLabelWidth">
                        <el-select v-model="form.age">
                            <el-option v-for="(ageitem,a) in fromLabel.age" :key="a" :label="ageitem.attriname" :value="ageitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item :label-width="formLabelWidth" label="学习渠道：">
                        <el-checkbox-group v-model="form.studyfrom">
                            <el-checkbox v-for="(studyfitem,g) in fromLabel.studyfrom" :key="g" :label="studyfitem.attriid" name="studyfrom">{{studyfitem.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="英语水平：" placeholder="选取英语水平" :label-width="formLabelWidth">
                        <el-select v-model="form.studylevel">
                            <el-option v-for="(slitem,b) in fromLabel.studylevel" :key="b" :label="slitem.attriname" :value="slitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="英语分数：" :label-width="formLabelWidth">
                        <el-input v-model="form.highscore" class="divided_2"></el-input>
                    </el-form-item>                     
                    <el-form-item :label-width="formLabelWidth" label="学习英语第一目标-课程：">
                        <el-checkbox-group v-model="form.wanttostudy">
                            <el-checkbox v-for="(ccitem,d) in fromLabel.curriculumType" :key="d" :label="ccitem.id" name="curriculumType">{{ccitem.title}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item :label-width="formLabelWidth" label="学习英语第二目标-方面：">
                        <el-checkbox-group v-model="form.studyhigh">
                            <el-checkbox v-for="(studyhitem,e) in fromLabel.studyhigh" :key="e" :label="studyhitem.attriid" name="studyhigh">{{studyhitem.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item :label-width="formLabelWidth" label="学习英语第三目标-知识：">
                        <el-checkbox-group v-model="form.studyextension">
                            <el-checkbox v-for="(studyexitem,f) in fromLabel.studyextension" :key="f" :label="studyexitem.attriid" name="studyextension">{{studyexitem.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="希望完成课程时间：" :label-width="formLabelWidth">
                        <el-select v-model="form.studyshijian">
                            <el-option v-for="(stshiitem,h) in fromLabel.studyshijian" :key="h" :label="stshiitem.attriname" :value="stshiitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预算：" :label-width="formLabelWidth">
                        <el-select v-model="form.studymoney">
                            <el-option v-for="(stmitem,i) in fromLabel.studymoney" :key="i" :label="stmitem.attriname" :value="stmitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="学员评测等级：" :label-width="formLabelWidth">
                        <el-select v-model="form.level">
                            <el-option v-for="(studylevel,j) in fromLabel.StudentEvaluationGrade" :key="j" :label="'level'+studylevel.attriname" :value="studylevel.attriname"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="学员目标等级：" :label-width="formLabelWidth">
                        <el-select v-model="form.targetlevel">
                            <el-option v-for="(studylevel,k) in fromLabel.StudentEvaluationGrade" :key="k" :label="'level'+studylevel.attriname" :value="studylevel.attriname"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="学习诉求：" :label-width="formLabelWidth">
                        <el-input v-model="form.iwant" class="divided_2"></el-input>
                    </el-form-item> 
                    <el-form-item label="学员分组：" :label-width="formLabelWidth">
                        <el-select v-model="form.groupid">
                            <el-option v-for="(mgitem,l) in fromLabel.member_group" :key="l" :label="mgitem.name" :value="mgitem.groupid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="第一次付费金额：" :label-width="formLabelWidth">
                        <el-input v-model="form.firstpay" class="divided_2"></el-input>
                    </el-form-item> 
                     <el-form-item label="老师寄语：" :label-width="formLabelWidth">
                        <el-input v-model="form.tutorcomment" class="divided_2"></el-input>
                    </el-form-item> 
                    <el-form-item label="学员状态：" :label-width="formLabelWidth">
                        <el-select v-model="form.status" placeholder="选择状态">
                            <el-option v-for="(membersta,s) in fromLabel.memberStatusList" :key="s" :label="membersta.attriname" :value="membersta.attriid"></el-option>
                        </el-select>
                    </el-form-item>   
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button class="dialog_close" @click="dialogFormVisible = false">取 消</el-button>
                    <el-button class="dialog_confirm" type="primary" @click="editAdult">确 定</el-button>
                </div>
            </el-dialog>
        </div>
        <!-- 档案 -->
        <div>
             <el-dialog title="查看少儿学员资料" :modal=false :close-on-click-modal=false v-if="ifchild"  
             :append-to-body="true" :visible.sync="dialogFormVisible2">
                <el-form :model="form">
                    <el-form-item label-width="80px">
                        <div class="member_info">学员信息</div>
                    </el-form-item>
                    <el-form-item label="学员账号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.username"></el-input>
                    </el-form-item>
                    <el-form-item label="英文名：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.nickname"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.mobile"></el-input>
                    </el-form-item>
                    <el-form-item label="中文名：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.fullname"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="发送信息给学员：" :label-width="formLabelWidth">
                        <el-radio-group disabled v-model="form.sendmail">
                            <el-radio label=1>是</el-radio>
                            <el-radio label=0>否</el-radio>
                        </el-radio-group>
                    </el-form-item> -->
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.wx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="QQ：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.qq"></el-input>    
                    </el-form-item>
                    <el-form-item label="SKype：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.skypenum" ></el-input>
                    </el-form-item>
                    <el-form-item label="Email：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.email"></el-input>
                    </el-form-item>
                    <el-form-item label="性别：" :label-width="formLabelWidth">
                        <el-radio-group  disabled v-model="form.gender">
                            <el-radio label=1>男</el-radio>
                            <el-radio label=0>女</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="年龄：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.email"></el-input>
                    </el-form-item>
                    <el-form-item label="出生日期：" :label-width="formLabelWidth">
                        <div class="block">
                            <el-date-picker
                                v-model="form.birthday"
                                type="date"
                                disabled
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                            </el-date-picker>
                        </div>
                    </el-form-item>
                    <el-form-item label="喜欢的动画片或玩具：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.toycartoon"></el-input>
                    </el-form-item>
                    <el-form-item label="所在年级：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.shoolPeriod" @change='getPeriod' placeholder="选择学年" class="divided_3">
                            <el-option 
                            v-for="(sp,a) in childData.shoolperiod"
                            :key="a" :label="sp.attriname" 
                            :value="sp.attriid"></el-option>
                        </el-select>
                        <el-select disabled v-model="form.grade" placeholder="选择年级" class="divided_3">
                            <el-option v-for="(gradeitem,gd) in grade_lists" :key='gd' :label="gradeitem" :value="gd"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="性格特点：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.character" placeholder="选择性格">
                            <el-option 
                            v-for="(childcc,b) in childData.childcharacters"
                            :key="b" :label="childcc.attriname" :value="childcc.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="礼品邮寄地址：" :label-width="formLabelWidth">
                        <el-cascader
                            size="large"
                             disabled
                            :options="options"
                            v-model="form.address"
                            @change="handleChange">
                        </el-cascader>
                        <el-input v-model="form.giftAddr" class="divided_200"></el-input>
                    </el-form-item>
                    <el-form-item :label-width="formLabelWidth" label="学习渠道：">
                        <el-checkbox-group disabled v-model="form.studyfrom">
                            <el-checkbox 
                            v-for="(studyf,d) in childData.studyfrom"
                            :key="d" :label="studyf.attriid">{{studyf.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label-width="80px">
                        <div class="member_info">家庭信息</div>
                    </el-form-item>
                    <el-form-item label-width="80px">
                        <el-tag type="info">父亲信息</el-tag>
                    </el-form-item>
                    <el-form-item label="姓名：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.dadname"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.dadmobile"></el-input>
                    </el-form-item>
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.dadwx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="年龄：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.dadage"></el-input>
                    </el-form-item>
                    <el-form-item label="职业性质：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.dadjobs" placeholder="选择父亲职业">
                            <el-option 
                            v-for="(dadjob,e) in childData.jobs"
                            :key="e" :label="dadjob.attriname" :value="dadjob.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="工作单位：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.dad_workaddr"></el-input>
                    </el-form-item>
                    <el-form-item label-width="80px">
                        <el-tag type="info">母亲信息</el-tag>
                    </el-form-item>
                    <el-form-item label="姓名：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.mumname"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.mummobile"></el-input>
                    </el-form-item>
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.mumwx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="年龄：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.mumage"></el-input>
                    </el-form-item>
                    <el-form-item label="职业性质：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.mumjob" placeholder="选择母亲职业">
                            <el-option 
                            v-for="(mumjob,f) in childData.jobs"
                            :key="f" :label="mumjob.attriname" :value="mumjob.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="工作单位：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.mum_workaddr"></el-input>
                    </el-form-item>
                     <el-form-item label="家庭收入：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.familyincome" placeholder="请选择">
                            <el-option 
                            v-for="(fain,g) in childData.familyincomes"
                            :key="g" :label="fain.attriname" :value="fain.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否已经开始学习英语：" :label-width="formLabelWidth">
                        <el-radio-group disabled  v-model="form.alreadystudy">
                            <el-radio label=1>是</el-radio>
                            <el-radio label=0>否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item v-if='form.alreadystudy==1?true:false' label="学习了多久（单位：月）：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.studytime"></el-input>
                    </el-form-item>
                    <el-form-item v-if='form.alreadystudy==1?true:false' label="学习英语以哪种方式开始：" :label-width="formLabelWidth">
                        <el-radio-group disabled  v-model="form.stratway">
                            <el-radio 
                            v-for="(starw,h) in childData.startways"
                            :key="h" :label="starw.attriid">{{starw.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item v-if='form.alreadystudy==1?true:false' label="是否接触过外教课程：" :label-width="formLabelWidth">
                        <el-radio-group disabled  v-model="form.withforeign">
                            <el-radio label=1>是</el-radio>
                            <el-radio label=0>否</el-radio>
                        </el-radio-group>
                    </el-form-item>
                     <el-form-item v-if='form.withforeign==1?true:false' label="学习了多久（单位：月）：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.foreigntime"></el-input>
                    </el-form-item>
                    <el-form-item label="就读学校：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.schoolname"></el-input>
                    </el-form-item>
                     <el-form-item v-if='form.alreadystudy==1?true:false' label="孩子在校的英语成绩排名：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.englishrank" placeholder="选择排名">
                            <el-option 
                            v-for="(enrank,i) in childData.englishrank"
                            :key="i" :label="enrank.attriname" :value="enrank.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="孩子目前英语水平：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.englishlevel" placeholder="请选择">
                            <el-option 
                            v-for="(enlevel,j) in childData.englislevel"
                            :key="j" :label="enlevel.attriname" :value="enlevel.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="对孩子学习英语的期望：" :label-width="formLabelWidth">
                        <el-checkbox-group disabled v-model="form.expects">
                            <el-checkbox v-for="(expec,k) in childData.expects" :key="k" :label="expec.attriid" name="expects">{{expec.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                     <el-form-item label="更希望孩子提升哪些方面：" :label-width="formLabelWidth">
                        <el-checkbox-group disabled v-model="form.improvefields">
                            <el-checkbox v-for="(impf,l) in childData.improvefields" :key="l" :label="impf.attriid" name="improvefields">{{impf.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="选择机构时首选考虑因素：" :label-width="formLabelWidth">
                        <el-radio-group disabled  v-model="form.considerfield">
                            <el-radio v-for="(consfi,m) in childData.considerfields" :key="m" :label="consfi.attriid">{{consfi.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="每周预计投入学习时间：" :label-width="formLabelWidth">
                        <el-radio-group disabled  v-model="form.weekTime">
                            <el-radio v-for="(weekt,n) in childData.weektime" :key="n" :label="weekt.attriid">{{weekt.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="适合孩子的上课时间：" :label-width="formLabelWidth">
                        <el-checkbox-group disabled v-model="form.suitabletime">
                            <el-checkbox v-for="(suitt,o) in childData.suitabletime" :key="o" :label="suitt.attriid" name="suitabletime">{{suitt.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="每月孩子学习英语的预算：" :label-width="formLabelWidth">
                        <el-radio-group disabled  v-model="form.monthbudget">
                            <el-radio ref="ref" v-for="(monthb,p) in childData.monthbudget" :key="p" :label="monthb.attriid">{{monthb.attriname}}</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="希望完成课程时间：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.finishtime" placeholder="选择时间">
                            <el-option v-for="(studyshi,q) in childData.studyshijian" :key="q" :label="studyshi.attriname" :value="studyshi.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预算：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.budget" placeholder="选择预算">
                            <el-option v-for="(studymon,r) in childData.studymoney" :key="r" :label="studymon.attriname" :value="studymon.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="学习诉求：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.appeal"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="第一次付费金额：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.firstpay" disabled></el-input>
                    </el-form-item> -->
                    <el-form-item label="老师寄语：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.teachernote"></el-input>
                    </el-form-item>
                    <el-form-item label="学员状态：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.status" placeholder="选择状态">
                            <el-option v-for="(membersta,s) in childData.memberStatusList" :key="s" :label="membersta.attriname" :value="membersta.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <!-- 回访记录 -->
                <el-tag  class='recordStyle' type="info">回访记录</el-tag>
                <el-table
                    :data="gotRecord"
                    stripe 
                    size="mini"
                    border resizable
                    style="width: 100%;margin-left:40px;"
                    max-height="656">
                    <el-table-column label="回访结果" :align="align" :width="columWidth2">
                        <template slot-scope="scope">{{scope.row.lev1}} {{scope.row.lev2}} {{scope.row.lev3}}</template>
                    </el-table-column>
                    <el-table-column label="回访内容" :align="align" :width="columWidth2">
                        <template slot-scope="scope">{{scope.row.content}}</template>
                    </el-table-column>
                    <el-table-column label="回访人" :align="align" :width="columWidth">
                        <template slot-scope="scope">{{scope.row.agent ? scope.row.agent.realname:''}}</template>
                    </el-table-column>
                    <el-table-column label="回访时间" :align="align" :width="columWidth">
                        <template slot-scope="scope">{{scope.row._time}}</template>
                    </el-table-column>
                </el-table> 
                <div slot="footer" class="dialog-footer">
                    <el-button class="dialog_close" @click="closeDangan">关闭</el-button>
                </div>
            </el-dialog>
           
            <el-dialog title="查看成人学员信息" :close-on-click-modal=false v-if="!ifchild"  :append-to-body="true"  :visible.sync="dialogFormVisible2">
                <el-form :model="form" >
                     <el-form-item label="登录账号：" :label-width="formLabelWidth">
                        <el-input v-model="form.username" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="注册时间：" :label-width="formLabelWidth">
                        <el-input v-model="form.regdate" disabled></el-input>
                    </el-form-item>
                        <el-form-item label="上次登陆时间：" :label-width="formLabelWidth">
                        <el-input v-model="form.lastdate" disabled></el-input>
                    </el-form-item>
                        <el-form-item label="登录次数：" :label-width="formLabelWidth">
                        <el-input v-model="form.loginnum" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="英文名：" :label-width="formLabelWidth">
                        <el-input v-model="form.nickname" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="中文名：" :label-width="formLabelWidth">
                        <el-input v-model="form.fullname" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号：" :label-width="formLabelWidth">
                        <el-input v-model="form.mobile" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="Email：" :label-width="formLabelWidth">
                        <el-input v-model="form.email" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="性别：" :label-width="formLabelWidth">
                        <el-radio-group  v-model="form.gender" disabled>
                            <el-radio label=1>男</el-radio>
                            <el-radio label=0>女</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="大学：" :label-width="formLabelWidth">
                        <el-input v-model="form.daxue" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="专业：" :label-width="formLabelWidth">
                        <el-input v-model="form.zhuanye" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="公司：" :label-width="formLabelWidth">
                        <el-input v-model="form.gongsi" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="行业：" placeholder="选择一项行业" :label-width="formLabelWidth">
                        <el-select v-model="form.job" disabled>
                            <el-option v-for="(jobitem,c) in fromLabel.job" :key="c" :label="jobitem.attriname" :value="jobitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="职位：" :label-width="formLabelWidth">
                        <el-input v-model="form.zhiwei" disabled></el-input>
                    </el-form-item>
                    
                    <el-form-item label="公司网站：" :label-width="formLabelWidth">
                        <el-input v-model="form.gongsiwangzhi" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="公司电话：" :label-width="formLabelWidth">
                        <el-input v-model="form.gongsidianhua" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="公司人事联系人：" :label-width="formLabelWidth">
                        <el-input v-model="form.lianxiren" disabled class="divided_2"></el-input>
                    </el-form-item>
                    <el-form-item label="微信号：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.wx_number"></el-input>    
                    </el-form-item>
                    <el-form-item label="qq" :label-width="formLabelWidth">
                        <el-input v-model="form.qq" disabled></el-input>
                    </el-form-item>  
                    <el-form-item label="SKype：" :label-width="formLabelWidth">
                        <el-input v-model="form.skypenum" disabled></el-input>
                    </el-form-item>  
                    <el-form-item label="分类：" :label-width="formLabelWidth">
                        <el-radio-group  disabled v-model="form.isfirststudy">
                            <el-radio label=0>第一次学习</el-radio>
                            <el-radio label=1>上过体验课</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="年龄段：" placeholder="选取年龄段" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.age">
                            <el-option v-for="(ageitem,a) in fromLabel.age" :key="a" :label="ageitem.attriname" :value="ageitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item :label-width="formLabelWidth" label="学习渠道：">
                        <el-checkbox-group disabled v-model="form.studyfrom">
                            <el-checkbox v-for="(studyfitem,g) in fromLabel.studyfrom" :key="g" :label="studyfitem.attriid" name="studyfrom">{{studyfitem.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="英语水平：" placeholder="选取英语水平" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.studylevel">
                            <el-option v-for="(slitem,b) in fromLabel.studylevel" :key="b" :label="slitem.attriname" :value="slitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="英语分数：" :label-width="formLabelWidth">
                        <el-input v-model="form.highscore" disabled class="divided_2"></el-input>
                    </el-form-item>                     
                    <el-form-item :label-width="formLabelWidth" label="学习英语第一目标-课程：">
                        <el-checkbox-group disabled v-model="form.wanttostudy">
                            <el-checkbox v-for="(ccitem,d) in fromLabel.curriculumType" :key="d" :label="ccitem.id" name="curriculumType">{{ccitem.title}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item :label-width="formLabelWidth" label="学习英语第二目标-方面：">
                        <el-checkbox-group disabled v-model="form.studyhigh">
                            <el-checkbox v-for="(studyhitem,e) in fromLabel.studyhigh" :key="e" :label="studyhitem.attriid" name="studyhigh">{{studyhitem.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item :label-width="formLabelWidth" label="学习英语第三目标-知识：">
                        <el-checkbox-group disabled v-model="form.studyextension">
                            <el-checkbox v-for="(studyexitem,f) in fromLabel.studyextension" :key="f" :label="studyexitem.attriid" name="studyextension">{{studyexitem.attriname}}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <el-form-item label="希望完成课程时间：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.studyshijian">
                            <el-option v-for="(stshiitem,h) in fromLabel.studyshijian" :key="h" :label="stshiitem.attriname" :value="stshiitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预算：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.studymoney">
                            <el-option v-for="(stmitem,i) in fromLabel.studymoney" :key="i" :label="stmitem.attriname" :value="stmitem.attriid"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="学员评测等级：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.level">
                            <el-option v-for="(studylevel,j) in fromLabel.StudentEvaluationGrade" :key="j" :label="'level'+studylevel.attriname" :value="studylevel.attriname"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="学员目标等级：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.targetlevel">
                            <el-option v-for="(studylevel,k) in fromLabel.StudentEvaluationGrade" :key="k" :label="'level'+studylevel.attriname" :value="studylevel.attriname"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="学习诉求：" :label-width="formLabelWidth">
                        <el-input v-model="form.iwant" disabled class="divided_2"></el-input>
                    </el-form-item> 
                    <el-form-item label="学员分组：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.groupid">
                            <el-option v-for="(mgitem,l) in fromLabel.member_group" :key="l" :label="mgitem.name" :value="mgitem.groupid"></el-option>
                        </el-select>
                    </el-form-item>
                    <!-- <el-form-item label="第一次付费金额：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.firstpay" class="divided_2"></el-input>
                    </el-form-item>  -->
                     <el-form-item label="老师寄语：" :label-width="formLabelWidth">
                        <el-input disabled v-model="form.tutorcomment" class="divided_2"></el-input>
                    </el-form-item> 
                    <el-form-item label="学员状态：" :label-width="formLabelWidth">
                        <el-select disabled v-model="form.status" placeholder="选择状态">
                            <el-option v-for="(membersta,s) in fromLabel.memberStatusList" :key="s" :label="membersta.attriname" :value="membersta.attriid"></el-option>
                        </el-select>
                    </el-form-item>   
                </el-form>

                 <!-- 回访记录 -->
                <el-tag  class='recordStyle' type="info">回访记录</el-tag>
                <el-table
                    :data="gotRecord"
                    stripe 
                    size="mini"
                    border resizable
                    style="width: 100%;margin-left:40px;"
                    max-height="656">
                   <el-table-column label="回访时间" :align="align" :width="columWidth">
                        <template slot-scope="scope">{{scope.row.time | transData}}</template>
                    </el-table-column>
                    <el-table-column label="回访内容" :align="align" :width="columWidth2">
                        <template slot-scope="scope">{{scope.row.content}}</template>
                    </el-table-column>
                    <el-table-column label="回访人" :align="align" :width="columWidth">
                        <template slot-scope="scope">{{scope.row.agent ? scope.row.agent.realname:''}}</template>
                    </el-table-column>
                     <el-table-column label="回访结果" :align="align" :width="columWidth2">
                        <template slot-scope="scope">
                            {{scope.row.lev1}}{{scope.row.lev2?'-':''}}{{scope.row.lev2}}{{scope.row.lev3?'-':''}}{{scope.row.lev3}}
                        </template>
                    </el-table-column>
                </el-table> 


                <div slot="footer" class="dialog-footer">
                    <el-button class="dialog_close" @click="dialogFormVisible2 = false">关闭</el-button>
                </div>
            </el-dialog>
            
        </div>
        <!-- 个人账户 -->
        <el-dialog title="账户信息" v-if="isShow" width='60%' style="padding-right:0px;" :close-on-click-modal=false :modal=false :append-to-body="true" :visible.sync="dialogAccountVisible">
            <el-tabs type="border-card">
                <!-- 账户详情 -->
                <el-tab-pane label="账户详情">
                    <div>
                        <span>账户余额:&nbsp;&nbsp;&nbsp;&nbsp;{{accountBalance}}</span>
                        <el-button style="margin-left:30px" @click="dialogVisible=true;getAgentPackageList()" v-show="accountBalance!=0.00">余额购买</el-button>
                    </div>
                    <div class="centerTitle">正在使用</div>
                    <el-table
                        v-loading="loadingNow"
                        element-loading-text="加载中..."
                        :data="productDetail"
                        stripe 
                        size="mini"
                        border resizable
                        style="width: 150%"
                        max-height="656">
                        <el-table-column label="产品名称" :align="align">
                            <template slot-scope="scope">{{scope.row.productName}} :{{scope.row.quantity}} </template>
                        </el-table-column>
                        <el-table-column label="激活时间" :align="align">
                            <template slot-scope="scope">{{scope.row.activationDate | transData}}</template>
                        </el-table-column>
                        <el-table-column label="过期时间" :align="align">
                            <template slot-scope="scope">{{scope.row.overdueDate | transData}}</template>
                        </el-table-column>

                        <el-table-column 
                            fixed="right" 
                            :align="align"
                            min-width="220"
                            :data="studentsData"
                            label="操作">
                            <template slot-scope="scope">
                                <el-button
                                    size="mini" @click="applyDelay(scope.row.paid)">有效期延期</el-button>
                                <el-button
                                    size="mini" 
                                    v-if='scope.row.isQueryDelay==1?true:false'
                                    @click="queryLog(scope.row.paid)">查询延期申请记录</el-button>
                                <el-button
                                    size="mini"
                                    v-if='scope.row.status==0?true:false'
                                    type="danger" plain @click="lockProduct(scope.row.paid,-1)">锁定此套餐</el-button>
                                <el-button
                                    size="mini"
                                    v-if='scope.row.status==-1?true:false'
                                    @click="lockProduct(scope.row.paid,0)" type="danger" plain>已锁定</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="centerTitle">历史记录</div>
                    <el-table
                        v-loading="loadingFlow"
                        element-loading-text="加载中..."
                        :data="productHistory"
                        stripe 
                        size="mini"
                        border resizable
                        style="width: 150%"
                        max-height="656">
                        <el-table-column label="产品名称" :align="align">
                            <template slot-scope="scope">{{scope.row.productName}} :{{scope.row.quantity}}</template>
                        </el-table-column>
                        <el-table-column label="购买时间" :align="align">
                            <template slot-scope="scope">{{scope.row.addDate | transData}}</template>
                        </el-table-column>
                        <el-table-column label="激活时间" :align="align">
                            <template slot-scope="scope">{{scope.row.activationDate | transData}}</template>
                        </el-table-column>
                        <el-table-column label="过期时间" :align="align">
                            <template slot-scope="scope">{{scope.row.overdueDate | transData}}</template>
                        </el-table-column>
                        <el-table-column label="状态" :align="align">
                            <template slot-scope="scope">{{scope.row.status | judgeStatus}}</template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>

                <!-- 余额账户流水 -->
                <el-tab-pane label="余额账户流水">
                    <el-table
                        v-loading="loadingBalanceFlow"
                        element-loading-text="加载中..."
                        :data="balanceFlow"
                        stripe 
                        size="mini"
                        border resizable
                        style="width: 150%"
                        :max-height="tableHeight2">
                        <el-table-column label="" :align="align">
                            <template slot-scope="scope">成功支付</template>
                        </el-table-column>
                        <el-table-column label="用户名" :align="align" :width="columWidth3">
                            <template slot-scope="scope">{{scope.row.memberUsername}} </template>
                        </el-table-column>
                        <el-table-column label="产品名称" :align="align" :width="columWidth" :show-overflow-tooltip="true">
                            <template slot-scope="scope">{{scope.row.payProductContent}}</template>
                        </el-table-column>
                        <el-table-column label="数量" :align="align" :width="columWidth4">
                            <template slot-scope="scope">{{scope.row.payProductNum}}</template>
                        </el-table-column>
                        <el-table-column label="金额" :align="align" :width="columWidth4">
                            <template slot-scope="scope">{{scope.row.receiptAmount}} </template>
                        </el-table-column>
                        <el-table-column label="申请人" :align="align" :width="columWidth4">
                            <template slot-scope="scope">{{scope.row.operateAgent.realName}}</template>
                        </el-table-column>
                        <el-table-column label="交易类型" :align="align" :width="columWidth3">
                            <template slot-scope="scope">{{scope.row.tradeTypeContent}} </template>
                        </el-table-column>
                        <el-table-column label="付费方式" :align="align" :width="columWidth3">
                            <template slot-scope="scope">{{scope.row.tradeSourceContent}}</template>
                        </el-table-column>
                        <el-table-column label="订单提交时间" :align="align" :width="columWidth">
                            <template slot-scope="scope">{{scope.row.gmtPayment | transData}}</template>
                        </el-table-column>
                    </el-table>
                    <div class="balancePage">
                        <el-pagination
                            background
                            @current-change="handleCurrentChange2"
                            :current-page.sync="currentPage1"
                            :page-size="balanceSize"
                            small
                            layout="prev, pager, next, jumper"
                            :total="totalCount2">
                        </el-pagination>
                    </div>
                </el-tab-pane>
                <!-- 产品账户流水 -->
                <el-tab-pane label="产品账户流水">
                    <el-scrollbar>
                        <el-table
                        v-loading="loadingFlow"
                        element-loading-text="加载中..."
                        :data="accountFlow"
                        stripe 
                        size="mini"
                        border resizable
                        :max-height="tableHeight2-10">
                        <el-table-column label="" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.status}} </template>
                        </el-table-column>
                        <el-table-column label="用户名" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.studentName}} </template>
                        </el-table-column>
                        <el-table-column label="产品名称" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.productName}}</template>
                        </el-table-column>
                        <el-table-column label="数量" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.quantity}}</template>
                        </el-table-column>
                        <el-table-column label="原价" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.money}} </template>
                        </el-table-column>
                        <el-table-column label="现价" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.actrualmoney}}</template>
                        </el-table-column>
                        <el-table-column label="有效期" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.duedate}}天</template>
                        </el-table-column>
                        <el-table-column label="充值类型" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.rechargeType}} </template>
                        </el-table-column>
                        <el-table-column label="付费方式" :align="align" :width="columWidth6">
                            <template slot-scope="scope">{{scope.row.payType}}</template>
                        </el-table-column>
                        <el-table-column label="订单提交时间" :align="align">
                            <template slot-scope="scope">{{scope.row.addTime | transData}}</template>
                        </el-table-column>
                    </el-table>
                    </el-scrollbar>
                    
                </el-tab-pane>
            </el-tabs>
            <div slot="footer" class="dialog-footer">
                <el-button class="dialog_close" @click="dialogAccountVisible = false">关闭</el-button>
            </div>
        </el-dialog>

        <!-- 有效期延期 -->
        <el-dialog title="有效期延期" :close-on-click-modal=false :append-to-body="true" :visible.sync="dialogYouxiao">
            <el-form :model="form">
                    <el-form-item label-width="80px">
                        <div class="member_info">有效期延期</div>
                    </el-form-item>
                    <el-form-item label="用户名：" :label-width="formLabelWidth">
                        <el-input disabled v-model="stuProductInfo.nickname"></el-input>
                    </el-form-item>
                    <el-form-item label="产品名称：" :label-width="formLabelWidth">
                        <el-input disabled v-model="stuProductInfo.productName"></el-input>
                    </el-form-item>
                    <el-form-item label="修改有效期：" :label-width="formLabelWidth">
                        <!-- <el-input v-model="applyDate" :placeholder="stuProductInfo.overdueDate | transOverData"></el-input> -->
                        <el-date-picker 
                            type="date" 
                            :placeholder="stuProductInfo.overdueDate | transOverData"
                            v-model="applyDate" 
                            value-format="timestamp"
                            style="width:300px;"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="申请备注：" :label-width="formLabelWidth">
                        <el-input v-model="applyNote"></el-input>
                    </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button class="dialog_close" @click="dialogYouxiao = false">关 闭</el-button>
                <el-button class="dialog_confirm" type="primary" @click="comfrimApply">保 存</el-button>
            </div>
        </el-dialog>

        <!-- 查询延期申请记录 -->
        <el-dialog title="查询延期申请记录" :close-on-click-modal=false :append-to-body="true" :visible.sync="dialogApplyLog">
            <el-table
                v-loading="loadingDlay"
                element-loading-text="加载中..."
                :data="delayList"
                stripe 
                size="mini"
                border resizable
                style="width: 150%"
                max-height="460">
                <el-table-column label="产品名称" :align="align" :width="columWidth3">
                    <template slot-scope="scope">{{scope.row.productName}}</template>
                </el-table-column>
                <el-table-column label="原有效期" :align="align" :width="columWidth">
                    <template slot-scope="scope">{{scope.row.overduedate | transData2}}</template>
                </el-table-column>
                <el-table-column label="申请有效期" :align="align" :width="columWidth">
                    <template slot-scope="scope">{{scope.row.applydate | transData2}} </template>
                </el-table-column>
                <el-table-column label="申请人" :align="align" :width="columWidth4">
                    <template slot-scope="scope">{{scope.row.applyName}}</template>
                </el-table-column>
                <el-table-column label="申请时间" :align="align" :width="columWidth">
                    <template slot-scope="scope">{{scope.row.applytime | transData}}</template>
                </el-table-column>
                <el-table-column label="状态" :align="align" :width="columWidth3">
                    <template slot-scope="scope">{{scope.row.type | filterStatu}} </template>
                </el-table-column>
                <el-table-column label="审核时间" :align="align" :width="columWidth">
                    <template slot-scope="scope">{{scope.row.admintime | transData}}</template>
                </el-table-column>
            </el-table>
            <div slot="footer" class="dialog-footer">
                <el-button class="dialog_close" @click="dialogApplyLog = false">关 闭</el-button>
            </div>
        </el-dialog>
        <!-- 添加回访记录 -->
        <!-- :modal=false  -->
        <!-- <div> -->
        <el-dialog title="添加回访记录" :modal=false :close-on-click-modal=false :visible.sync="dialogFormVisible3">
            <el-tag  class='recordStyle' type="info">CC电话回访</el-tag>
            <el-form >
                <!-- <el-form-item label="回访人：" placeholder="cc回访" label-width="160px">
                    <el-select v-model="revisit ">
                        <el-option label="CC回访" value="1"></el-option>
                    </el-select>
                </el-form-item> -->
                <el-form-item label="呼出结果分类：" placeholder="cc回访" label-width="160px">
                    <el-select placeholder="一级菜单" v-model="yiji"  @change='firstMenuChange' class="divided_140"  style="float:left;">
                        <el-option v-for="(menu1,m1) in returnMenu" :key="m1" :label="menu1.attriname" :value="menu1.attriid"></el-option>
                    </el-select>
                    <el-select placeholder="二级菜单" v-model="erji" @change='secondMenuChange' class="divided_140" style="float:left;">
                        <el-option v-for="(menu2,m2) in returnMenu2" :key="m2" :label="menu2.attriname" :value="menu2.attriid"></el-option>
                    </el-select>
                    <el-select placeholder="三级菜单" v-model="sanji" class="divided_140" style="float:left;">
                        <el-option v-for="(menu3,m3) in returnMenu3" :key="m3" :label="menu3.attriname" :value="menu3.attriid"></el-option>
                    </el-select>
                    <el-form-item label="预约时间：" v-if="yiji==172?true:false" label-width="90px" style="float:left;">
                            <el-date-picker
                                v-model="reserveTime"
                                type="date"
                                style='width:140px;'
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                            </el-date-picker>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="回访结果：" label-width="160px">
                    <el-input v-model="returnResult"></el-input>
                </el-form-item>
            </el-form>
            <!-- 回访记录 -->
            <el-tag  class='recordStyle' type="info">回访记录</el-tag>
            <el-table
                v-loading="loading3"
                element-loading-text="加载中..."
                :data="gotRecord"
                stripe 
                size="mini"
                border resizable
                style="width: 100%;position: relative;left: 40px;"
                max-height="656">
                <el-table-column label="回访时间" :align="align" :width="columWidth">
                    <template slot-scope="scope">{{scope.row.time | transData}}</template>
                </el-table-column>
                <el-table-column label="回访内容" :align="align" :width="columWidth2">
                    <template slot-scope="scope">{{scope.row.content}}</template>
                </el-table-column>
                <el-table-column label="回访人" :align="align" :width="columWidth">
                    <template slot-scope="scope">{{scope.row.agent ? scope.row.agent.realname:''}}</template>
                </el-table-column>
                <el-table-column label="回访结果" :align="align" :width="columWidth2">
                    <template slot-scope="scope">
                        {{scope.row.lev1}}{{scope.row.lev2?'-':''}}{{scope.row.lev2}}{{scope.row.lev3?'-':''}}{{scope.row.lev3}}
                    </template>
                </el-table-column>                 
            </el-table>
            <div slot="footer" class="dialog-footer">
                <el-button class="dialog_close" @click="dialogFormVisible3 = false">取 消</el-button>
                <el-button class="dialog_confirm" type="primary" @click="submitRecord">确 定</el-button>
            </div>
        </el-dialog>
        <!-- </div> -->

        <!-- 余额购买 -->
        <el-dialog title="余额购买" :visible.sync="dialogVisible" :append-to-body="true" :close-on-click-modal="false" :modal="false" @close="resetForm('purchaseForm')">
            <el-form :model="purchaseForm" label-width="140px" class="purchaseForm" ref="purchaseForm" :rules="rules2" v-loading="loadingPurchase">
                <el-form-item label="学员姓名:"> 
                    <el-input v-model="purchaseForm.username" disabled></el-input>
                </el-form-item>
                <el-form-item label="学员账号:"> 
                    <el-input v-model="purchaseForm.account" disabled></el-input>
                </el-form-item>
            
                <!-- 产品卡 -->
                <div class="addBtnBox">
                    <el-button @click="addProduct">增加产品</el-button>
                </div>
                <el-card class="box-card" v-for='(card,index) in packageData' :key='"packageData"+index' >
                        <template v-if="index!=0">
                            <div slot="header" class="clearfix">
                                <el-button @click="removeProduct(index)" id="closeIcon" icon='el-icon-close' type="text"></el-button>
                            </div>
                        </template>
                        <div class="text item" style="margin: 6px 0;padding: 10px 0 1px 0;">
                            <el-form-item label="产品类型：">
                                <el-select v-model="purchaseForm.packageContains[index].payProductId" @change="selectGet">
                                    <el-option v-for='(pro,i) in packageData[0].productType' :key="'pro'+i" :label="pro.packageName" :value="pro.id"></el-option>
                                </el-select>
                            </el-form-item> 
                            <el-form-item label="产品名称：" v-show="purchaseForm.packageContains[index].otherType">
                                <el-input v-model.trim="purchaseForm.packageContains[index].remark" class="divided_2"></el-input>
                            </el-form-item>
                            <el-form-item label="数量：">
                                <el-input v-model.trim="purchaseForm.packageContains[index].num" class="divided_2"></el-input>
                                <!-- <el-input-number v-model="purchaseForm.packageContains[index].num" controls-position="right" :min="1"></el-input-number> -->
                            </el-form-item>
                            <el-form-item label="金额：" v-show="purchaseForm.packageContains[index].otherType">
                                <el-input v-model.trim="purchaseForm.packageContains[index].payAmount" class="divided_2"></el-input>
                            </el-form-item>
                        </div>
                    </el-card>

                    <!-- 随单赠送 -->
                    <el-card class="box-card" v-for='(card,index) in giftProduct' :key='"gift"+index' >
                        <div class="text item" style="margin: 6px 0;padding: 10px 0 1px 0;">
                            <el-form-item label="产品类型：">
                                <el-select v-model="purchaseForm.giftCard[index].payProductId" @change="selectGet" clearable>
                                    <el-option v-for='(pro,i) in card.productType'
                                        :key="'pro'+i"
                                        :label="pro.packageName"
                                        :value="pro.id"></el-option>
                                </el-select>
                            </el-form-item> 
                            <span class="giftText">随单赠送</span>
                            <el-form-item label="产品名称：" v-show="purchaseForm.giftCard[index].otherType">
                                <el-input v-model.trim="purchaseForm.giftCard[index].remark" class="divided_2"></el-input>
                            </el-form-item>
                            <el-form-item label="数量：">
                                <el-input v-model.trim="purchaseForm.giftCard[index].num" class="divided_2"></el-input>
                            </el-form-item>
                            <el-form-item label="金额：" v-show="purchaseForm.giftCard[index].otherType">
                                <el-input v-model.trim="purchaseForm.giftCard[index].payAmount" class="divided_2"></el-input>
                            </el-form-item>
                        </div>
                    </el-card>
                    <el-form-item label="余额金额扣除：" style="margin-top:10px;" prop="amount">
                        <el-input v-model.trim="purchaseForm.amount"></el-input>
                    </el-form-item>
                </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button class="dialog_close" @click="dialogVisible = false" :disabled="btnPurchse">取 消</el-button>
                <el-button class="dialog_confirm" type="primary" @click="submitPurchaseForm()" :disabled="btnPurchse">确 定</el-button>
            </div>
        </el-dialog>

        <div class="page_block">
            <el-pagination
                background
                @current-change="handleCurrentChange"
                :current-page.sync="currentPage"
                :page-size="15"
                small
                layout="prev, pager, next, jumper"
                :total="totalCount">
            </el-pagination>
        </div>
  </div>
</template>

<script>
import base from "../api/base.js";
import md5 from "js-md5";
import Qs from "qs";
import { formatDate } from "../../static/js/date.js";
import { regionData } from "element-china-area-data";
import bus from "./../../static/js/bus.js";
export default {
  data() {
    var validateAmount = (rule, value, callback) => {
        var reg1 = /^[0-9]+([.]{1}[0-9]{1,2}){0,1}$/;
        var reg2 = /^[0-9]+([.]{1}[0-9]+){0,1}$/;
        if(reg2.test(value)){
            this.purchaseForm.amount=Number(this.purchaseForm.amount).toString()
            if(value>0){
            if(reg1.test((Number(value).toString()))){
                callback();
            }else{
                callback(new Error("最小收款单位不能低于分"));
            }
            }else{
            callback(new Error('输入金额需要大于零'))
            }
        }else{
            callback(new Error('输入格式有误'))
        }
    }
      
    return {
        isShow:false,
        btnPurchse:false,
        loadingPurchase:false,
      tableHeight: window.innerHeight - 300,
      dialogAccountVisible: false, //个人账户
      productDetail: [], //账户详情
      accountBalance: "", //账户余额
      lockType: "", //-1 锁定  0解锁
      paid: "", //列表页paid
      // overdueDate:'',//旧有效期
      applyDate: "", //新有效期
      applyNote: "", //申请备注
      accountFlow: [], //现金账户流水
      balanceFlow: [], //余额账户流水
      productHistory: [],
      delayList: [], //延期列表
      dialogYouxiao: false, //有效期弹框
      stuProductInfo: "", //有效期信息
      dialogApplyLog: false, //查看记录弹窗
      dialogVisible: false, //余额购买弹框
      // studentId:'',
      loading2: true,
      loading3: true,
      loadingNow: true,
      loadingFlow: true,
      loadingBalanceFlow: true,
      loadingHistory: true,
      loadingDlay: [],
      status: [],
      agents: [],
      formInline: {
        username_kw: "",
        nickname_kw: "",
        status: "",
        agentid: ""
      },
      ifchild: "",
      userid: "", //选中的学员
      userInfo: [],
      columWidth: 170,
      columWidth2: 240,
      columWidth3: 100,
      columWidth6: 70,
      columWidth4: 80,
      columWidth5: 89,
      align: "center",
      studentsData: [],
      returnMenu: [], //回访菜单1
      returnMenu2: [], //回访菜单2
      returnMenu3: [], //回访菜单3
      firstMenu: [], //一级菜单id
      secondMenu: [], //二级菜单id
      // =============================================添加回访表单
      yiji: "",
      erji: "",
      sanji: "",
      revisit: 1, //回访人
      returnResult: "", //回访结果
      reserveTime: "",
      dialogFormVisible: false,
      dialogFormVisible2: false, //档案
      dialogFormVisible3: false, //添加回访记录
      formLabelWidth: "200px",
      // 分页数据
      currentPage: 1,
      currentPage1: 1,
      totalCount: 0,
      totalCount2: 0,
      cur_page: 1,
      cur_page1: 1,
      page_size: 15,
      fromLabel: [],
      childData: [],
      form: {
        //  =======================================成人表单数据
        nickname: "",
        new_pwd: "",
        fullname: "",
        mobile: "",
        email: "",
        gender: "",
        face: "",
        daxue: "",
        zhuanye: "",
        gongsi: "",
        job: "",
        zhiwei: "",
        gongsiwangzhi: "",
        gongsidianhua: "",
        lianxiren: "",
        qq: "",
        skypenum: "",
        isfirststudy: "",
        age: "",
        studylevel: "",
        highscore: "",
        province: "",
        cityname: "",
        district: "",
        wanttostudy: [],
        studyhigh: [],
        studyextension: [],
        // studyfrom:[],
        studyshijian: "",
        StudentEvaluationGrade: "",
        level: "",
        targetlevel: "",
        iwant: "",
        groupid: "",
        firstpay: "",
        tutorcomment: "",
        status: "",
        //  =======================================少儿
        wx_number: "",
        dadwx_number: "",
        mumwx_number: "",
        dad_workaddr: "",
        mum_workaddr: "",
        username: "",
        regdate: "",
        lastdate: "",
        loginnum: "",
        new_pwd: "",
        // nickname: '',
        mobile: "",
        fullname: "",
        sendmail: "",
        // qq: '',
        // skypenum:'',
        email: "",
        gender: "",
        birthday: "",
        toycartoon: "",
        shoolPeriod: "", //学年
        xuenianid: "",
        grade: "", //年级
        character: "",
        avatar: "",
        // province: '',//省
        // cityname:'',//市
        // district: '',//区
        giftAddr: "",
        studyfrom: [], //学习渠道
        dadname: "", //父亲
        dadmobile: "",
        dadage: "",
        dadjob: "",
        mumname: "", //母亲
        mummobile: "",
        mumage: "",
        mumjob: "",
        familyincome: "", //家庭收入
        alreadystudy: "",
        studytime: "",
        stratway: "",
        withforeign: "", //是否接触其他外教课程
        foreigntime: "",
        schoolname: "",
        englishrank: "",
        englishlevel: "",
        expects: [],
        improvefields: [],
        considerfield: "", //考虑方面
        weekTime: "",
        suitabletime: [],
        monthbudget: "",
        finishtime: "",
        budget: "",
        appeal: "",
        teachernote: "",
        state: "",
        delivery: false,
        address: []
      },
      // 省市区
      options: regionData,
      // 头像
      upLoadData: {
        bucket: "avatar"
      },
      avatar_url: base.baseUrl + "/forum/upload/index",
      // 获取的年级列表
      grade_lists: "",
      address: [],
      //回访记录
      gotRecord: [],
      writeRecord: [
        {
          result: "",
          content: "",
          writer: "",
          time: ""
        }
      ], //添加
      returnForm: [], //回访表单,
      xxSelect: false,
      // 余额购买表单数据
      purchaseForm: {
        username: "",
        account: "",
        memberId: "",
        // 产品卡
        packageContains: [
          {
            payProductId: "",
            num: "",
            remark: "",
            payAmount: "",
            tradeType: 2015,
            otherType: false
          }
        ],
        // 随单赠送卡
        giftCard: [
          {
           payProductId: "",
            num: "",
            remark: "",
            payAmount: "",
            tradeType: 2017,
            otherType: false
          }
        ],
        // 余额扣除
        amount: ""
      },
       rules2: {
        amount: [
            { required: true, message: "请填写扣除金额", trigger: "blur" },
            { validator: validateAmount, trigger: 'blur' }
            ],
      },
      // 产品信息
      packageData: [{ productType: [] }],
      //   随单赠送产品信息
      giftProduct: [{ productType: [] }],
      tableHeight2: window.innerHeight *0.75-300,
      balanceSize:9
    };
  },
  methods: {
    // 账户
    accountInfoDialog(uid, tel,row) {
      this.userid = uid;
      this.dialogAccountVisible = true;
      this.getStudentProduct();
      this.getProductHistory();
      this.getCashFlow();
      this.getBalanceFlow();
      this.getStudentBalance(tel);
        // this.getAgentPackageList();
      this.isShow=true;
      this.purchaseForm.memberId=uid
    //   this.purchaseForm.username=row.fullName? row.fullName: row.nickname;
      this.purchaseForm.account=tel;
      
    },
    getpages(val){
        console.log(val)
    },
    // 获取学生账户余额
    getStudentBalance(tel) {
      let data = Qs.stringify({
        token:localStorage.token,
        // token: "9f063cd31dd559824941e3d47fc69abc#100230",
        tel: tel
      });
      this.$axios({
        url: base.baseUrl2 + "/v1/agent/agent-student/search-tel",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.status == 4000) {
          this.alertTip(res.data.message);
        } else if (res.data.status == 2000) {
          this.accountBalance = res.data.data.member.balance;
            this.purchaseForm.username=res.data.data.member.fullName? res.data.data.member.fullName: res.data.data.member.nickname;
        } else if (res.data.status == 2001) {
          this.$router.push("/login");
        }
      }).catch(error=>{
          console.log(error)
          this.alertTip("网络异常收银失败，请检查网络稍后再试")
        });
    },
    //账户详情
    getStudentProduct() {
      let data = Qs.stringify({
        token: localStorage.token,
        // userId:168189
        userId: this.userid
      });
      this.$axios({
        url: base.baseUrl + "/school/product/get-student-product",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.loadingNow = false;
          this.productDetail = res.data.data;
        }
      });
    },
    // 历史产品记录
    getProductHistory() {
      let data = Qs.stringify({
        token: localStorage.token,
        userId: this.userid
        // userId:168189
      });
      this.$axios({
        url: base.baseUrl + "/school/product/history-product",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.loadingHistory = false;
          this.productHistory = res.data.data;
        }
      });
    },
    // 申请有效期延期按钮
    applyDelay(paid) {
      this.dialogYouxiao = true;
      this.paid = paid;
      this.applyDate = this.applyNote = "";
      this.getProductDue();
    },
    // 获取有效期信息
    getProductDue() {
      let data = Qs.stringify({
        token: localStorage.token,
        paid: this.paid
      });
      this.$axios({
        url: base.baseUrl + "/school/product/get-student-product-info",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.stuProductInfo = res.data.data;
        }
      });
    },
    comfrimApply() {
      let data = Qs.stringify({
        token: localStorage.token,
        paid: this.paid,
        overdueDate: this.stuProductInfo.overdueDate,
        applyDate: this.applyDate / 1000,
        applyNote: this.applyNote
      });
      this.$axios({
        url: base.baseUrl + "/school/product/apply-delay-date",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == -1) {
          this.$alert(res.data.msg);
        } else if (res.data.code == 200) {
          this.$alert(res.data.msg, "提示", {
            confirmButtonText: "确定",
            callback: action => {
              this.getStudentProduct();
            }
          });
          this.dialogYouxiao = false;
        }
      });
    },
    // 查询延期申请记录
    queryLog(paid) {
      this.paid = paid;
      this.dialogApplyLog = true;
      this.getDelayList();
    },
    getDelayList() {
      let data = Qs.stringify({
        token: localStorage.token,
        paid: this.paid
      });
      this.$axios({
        url: base.baseUrl + "/school/product/get-delay-list",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.loadingDlay = false;
          this.delayList = res.data.data;
        }
      });
    },
    // 锁定套餐
    lockProduct(paid, locktype) {
      this.paid = paid;
      this.lockType = locktype;

      var lockTip;
      if (locktype == -1) {
        lockTip = "确定要锁定此套餐吗";
      } else {
        lockTip = "确定要解除锁定吗";
      }

      this.$confirm(lockTip, {
        distinguishCancelAndClose: true,
        confirmButtonText: "确定",
        cancelButtonText: "取消"
      })
        .then(() => {
          this.toLockPro();
        })
        .catch(action => {});
    },
    toLockPro() {
      let data = Qs.stringify({
        token: localStorage.token,
        paid: this.paid,
        type: this.lockType
      });
      this.$axios({
        url: base.baseUrl + "/school/product/lock-product",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.getStudentProduct();
        }
        this.$alert(res.data.msg);
      });
    },
    //产品账户流水
    getCashFlow() {
      let data = Qs.stringify({
        token: localStorage.token,
        userId: this.userid
        // userId:168189
      });
      this.$axios({
        url: base.baseUrl + "/school/account/student-cash-flow",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.loadingFlow = false;
          this.accountFlow = res.data.data;
        }
      });
    },
    // 获取余额账户流水
    getBalanceFlow(val=0) {
        this.loadingBalanceFlow=true
      let data = Qs.stringify({
        token:localStorage.token,
        // token: "9f063cd31dd559824941e3d47fc69abc#100230",
        memberId: this.userid,
        pageIndex:val,
        pageSize:this.balanceSize
        // userId:168189
      });
      this.$axios({
        url: base.baseUrl2 + "/v1/account/member-account/statement",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
           this.loadingBalanceFlow = false;
       if (res.data.status == 4000) {
          this.alertTip(res.data.message);
        } else if (res.data.status == 2000) {
          this.balanceFlow = res.data.data.memberAccountStatement;
          this.totalCount2 = Number(res.data.page.totalRows)
        } else if (res.data.status == 2001) {
          this.$router.push("/login");
        }
      }).catch(error=>{
          console.log(error)
          this.alertTip("网络异常收银失败，请检查网络稍后再试")
        });;
    },
    sendStudentId(row) {
      bus.$emit("sendstuid", row);
    },
    handleCurrentChange(val) {
      this.loading2 = true;
      this.cur_page = val;
      this.getData();
    },
    handleCurrentChange2(val) {
      this.cur_page1 = val;
      this.getBalanceFlow(val-1);
    },

    // 编辑资料
    handleEdit(uid, ischild) {
      this.userid = uid;
      this.dialogFormVisible = true;
      if (ischild == 1) {
        this.ifchild = true;
        this.getUserInfo();
      } else {
        this.ifchild = false;
        this.getUserInfo();
      }
      this.getAdultform();
      this.getChildform();
    },
    getData(cr) {
      if (cr) {
        this.currentPage = 1;
        this.cur_page = 1;
      }
      let data = Qs.stringify({
        token: localStorage.token,
        p: this.cur_page,
        page_size: this.page_size,
        nickname_kw: this.formInline.nickname_kw,
        username_kw: this.formInline.username_kw,
        status: this.formInline.status,
        agentid: this.formInline.agentid
      });
      this.$axios({
        url: base.baseUrl + "/school/member/get-member-list",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == -1) {
          this.alertTip(res.data.msg);
        } else if (res.data.code == 200) {
          this.studentsData = res.data.data.member_list;
          this.loading2 = false;
          this.totalCount = Number(res.data.data.pages.total_count);
        } else if (res.data.code == -2) {
          this.$router.push("/login");
        }
      });
    },
    clearSearch() {
      this.formInline.agentid = "";
      this.formInline.status = "";
      this.formInline.username_kw = "";
      this.formInline.nickname_kw = "";
      this.getData();
    },
    closeDangan() {
      this.dialogFormVisible2 = false;
      // this.fromLabel=this.childData=[]
    },
    // 获取学员信息
    getUserInfo() {
      let data = Qs.stringify({
        token: localStorage.token,
        userid: this.userid
      });
      this.$axios({
        url: base.baseUrl + "/school/member/get-student-info",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        // this.userInfo=res.data.data;
        // this.form.address.push(this.userInfo.memberdetail.giftprovince,this.userInfo.memberdetail.giftcity,this.userInfo.memberdetail.giftdistrict);
        if (res.data.code == -1) {
          this.alertTip(res.data.msg);
        } else if (res.data.code == 200) {
          this.userInfo = res.data.data;

          // 成人
          this.form.face =this.form.avatar= this.userInfo.memberdetail.face;
          this.form.nickname = this.userInfo.nickname;
          this.form.fullname = this.userInfo.fullname;
          this.form.mobile = this.userInfo.mobile;
          this.form.email = this.userInfo.email;
          this.form.gender = this.userInfo.memberdetail.gender;
          this.form.province = this.userInfo.memberdetail.giftprovince;
          this.form.cityname = this.userInfo.memberdetail.giftcity;
          this.form.district = this.userInfo.memberdetail.giftdistrict;
          this.form.address.push(
            this.userInfo.memberdetail.giftprovince,
            this.userInfo.memberdetail.giftcity,
            this.userInfo.memberdetail.giftdistrict
          );
          this.form.daxue = this.userInfo.memberdetail.daxue;
          this.form.gongsi = this.userInfo.memberdetail.gongsi;
          this.form.job = this.userInfo.memberdetail.job;
          this.form.zhiwei = this.userInfo.memberdetail.zhiwei;
          this.form.qq = this.userInfo.memberdetail.qq;
          this.form.skypenum = this.userInfo.memberdetail.skypenum;
          this.form.isfirststudy = this.userInfo.memberdetail.isfirststudy;
          this.form.age = this.userInfo.memberdetail.age;
          this.form.studyfrom = this.userInfo.memberdetail.studyfrom;
          this.form.studylevel = this.userInfo.memberdetail.studylevel;
          this.form.wanttostudy = this.userInfo.memberdetail.wanttostudy;
          this.form.highscore = this.userInfo.memberdetail.highscore;
          this.form.studyextension = this.userInfo.memberdetail.studyextension;
          this.form.studyhigh = this.userInfo.memberdetail.studyhigh;
          this.form.studyshijian = this.userInfo.memberdetail.studyshijian;
          this.form.groupid = this.userInfo.groupid;
          this.form.targetlevel = this.userInfo.memberdetail.targetlevel;
          this.form.iwant = this.userInfo.memberdetail.iwant;
          this.form.level = this.userInfo.memberdetail.level;
          this.form.firstpay = this.userInfo.memberdetail.firstpay;
          this.form.tutorcomment = this.userInfo.memberdetail.tutorcomment;
          this.form.status = this.userInfo.status;
          this.form.budget = this.userInfo.memberdetail.budget;

          //少儿
          this.form.username = this.userInfo.username;
          this.form.regdate = this.userInfo.regdate;
          this.form.lastdate = this.userInfo.lastdate;
          this.form.loginnum = this.userInfo.loginnum;
          this.form.sendmail = this.userInfo.sendemail;
          // this.form.birthday=this.userInfo.memberdetail.birthday;
          this.form.toycartoon = this.userInfo.memberchild.toycartoon;
          this.form.grade = this.userInfo.memberchild.grade;
          this.form.birthday =
            this.userInfo.memberchild.birthyear +
            "-" +
            this.userInfo.memberchild.birthmonth +
            "-" +
            this.userInfo.memberchild.birthdate;
          this.form.character = this.userInfo.memberchild.character;
          // this.form.address=this.userInfo.memberdetail.giftprovince+'-'+this.userInfo.memberdetail.giftcity+'-'+this.userInfo.memberdetail.giftdistrict;
          this.form.dadname = this.userInfo.memberchild.dadname;
          this.form.dadage = this.userInfo.memberchild.dadage;
          this.form.dadjobs = this.userInfo.memberchild.dadjob;
          this.form.dadmobile = this.userInfo.memberchild.dadmobile;
          this.form.mumname = this.userInfo.memberchild.mumname;
          this.form.mummobile = this.userInfo.memberchild.mummobile;
          this.form.mumage = this.userInfo.memberchild.mumage;
          this.form.mumjob = this.userInfo.memberchild.mumjob;
          this.form.familyincome = this.userInfo.memberchild.familyincome;
          this.form.alreadystudy = this.userInfo.memberdetail.isfirststudy;
          this.form.stratway = this.userInfo.memberchild.stratway;
          this.form.withforeign = this.userInfo.memberchild.withforeign;
          this.form.studytime = this.userInfo.memberchild.learnedtime;
          this.form.foreigntime = this.userInfo.memberchild.foreigntime;
          this.form.schoolname = this.userInfo.memberchild.schoolname;
          this.form.englishrank = this.userInfo.memberchild.englishrank;
          this.form.englishlevel = this.userInfo.memberchild.englishlevel;
          this.form.expects = this.userInfo.memberchild.expect;
          this.form.improvefields = this.userInfo.memberchild.improvefields;
          this.form.considerfield = this.userInfo.memberchild.considerfield;
          this.form.weekTime = this.userInfo.memberchild.weektime;
          this.form.suitabletime = this.userInfo.memberchild.suitabletime;
          this.form.monthbudget = this.userInfo.memberchild.monthbudget;
          this.form.teachernote = this.userInfo.memberdetail.tutorcomment;
          this.form.finishtime = this.userInfo.memberdetail.studyshijian;
          this.form.budget = this.userInfo.memberdetail.studymoney;
          this.form.englishlevel = this.userInfo.memberdetail.studylevel;
          this.form.appeal = this.userInfo.memberdetail.iwant;

          this.form.wx_number = this.userInfo.memberdetail.wx_number;
          this.form.dadwx_number = this.userInfo.memberchild.dadwx_number;
          this.form.mumwx_number = this.userInfo.memberchild.mumwx_number;
          this.form.dad_workaddr = this.userInfo.memberchild.dad_workaddr;
          this.form.mum_workaddr = this.userInfo.memberchild.mum_workaddr;
        } else if (res.data.code == -2) {
          this.$router.push("/login");
        }
      });
    },
    // ==========================================成人
    getAdultform() {
      let data = Qs.stringify({
        token: localStorage.token
      });
      this.$axios({
        url: base.baseUrl + "/school/member/get-student-setting ",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.fromLabel = res.data.data;
        }
      });
    },
    editAdult() {
      this.$axios({
        url: base.baseUrl + "/school/member/set-adult-student",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          token: localStorage.token,
          userid: this.userid,
          nickname: this.form.nickname,
          new_pwd: this.form.new_pwd ? md5(this.form.new_pwd) : "",
          fullname: this.form.fullname,
          mobile: this.form.mobile,
          email: this.form.email,
          gender: this.form.gender,
          face: this.form.face,
          province: this.form.province,
          cityname: this.form.cityname,
          district: this.form.district,
          address: this.form.address,
          daxue: this.form.daxue,
          zhuanye: this.form.zhuanye,
          gongsi: this.form.gongsi,
          job: this.form.job,
          zhiwei: this.form.zhiwei,
          gongsiwangzhi: this.form.gongsiwangzhi,
          gongsidianhua: this.form.gongsidianhua,
          lianxiren: this.form.lianxiren,
          qq: this.form.qq,
          skypenum: this.form.skypenum,
          isfirststudy: this.form.isfirststudy,
          age: this.form.age,
          studyfrom: this.form.studyfrom,
          studylevel: this.form.studylevel,
          highscore: this.form.highscore,
          wanttostudy: this.form.wanttostudy,
          studyhigh: this.form.studyhigh,
          studyextension: this.form.studyextension,
          studyshijian: this.form.studyshijian,
          studymoney: this.form.studymoney,
          level: this.form.level,
          targetlevel: this.form.targetlevel,
          iwant: this.form.iwant,
          groupid: this.form.groupid,
          tutorcomment: this.form.tutorcomment,
          status: this.form.status,
          WxNumber: this.form.WxNumber
        },
        transformRequest: [
          function(data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          }
        ]
      }).then(res => {
        if (res.data.code == -1) {
          this.alertTip(res.data.msg);
        } else if (res.data.code == 200) {
          this.alertTip("编辑成功");
          this.dialogFormVisible = false;
        }
      });
    },
    // ==========================================儿童
    editChild() {
      this.$axios({
        url: base.baseUrl + "/school/member/set-child-student",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          token: localStorage.token,
          userid: this.userid,
          new_pwd: this.form.new_pwd ? md5(this.form.new_pwd) : "",
          nickname: this.form.nickname,
          mobile: this.form.mobile,
          fullname: this.form.fullname,
          sendmail: this.form.sendmail,
          qq: this.form.qq,
          skypenum: this.form.skypenum,
          email: this.form.email,
          gender: this.form.gender,
          birthday: this.form.birthday,
          toycartoon: this.form.toycartoon,
          schoolPeriod: this.form.shoolPeriod,
          grade: this.form.grade,
          character: this.form.character,
          avatar: this.form.avatar,
          province: this.form.province,
          cityname: this.form.cityname,
          district: this.form.district,
          giftAddr: this.form.giftAddr,
          studyFrom: this.form.studyfrom,
          dadname: this.form.dadname,
          dadmobile: this.form.mobile,
          dadage: this.form.dadage,
          dadjob: this.form.dadjob,
          mumname: this.form.mumname,
          mummobile: this.form.mummobile,
          mumage: this.form.mumage,
          mumjob: this.form.mumjob,
          familyincome: this.form.familyincome,
          alreadystudy: this.form.alreadystudy,
          studytime: this.form.studytime,
          stratway: this.form.stratway,
          withforeign: this.form.withforeign,
          foreigntime: this.form.foreigntime,
          schoolname: this.form.schoolname,
          englishrank: this.form.englishrank,
          englishlevel: this.form.englishlevel,
          expects: this.form.expects,
          improvefields: this.form.improvefields,
          considerfield: this.form.considerfield,
          weekTime: this.form.weekTime,
          suitabletime: this.form.suitabletime,
          monthbudget: this.form.monthbudget,
          finishtime: this.form.finishtime,
          budget: this.form.budget,
          appeal: this.form.appeal,
          teachernote: this.form.teachernote,
          state: this.form.status,
          WxNumber: this.form.wx_number,
          dadWxNumber: this.form.dadwx_number,
          mumWxNumber: this.form.mumwx_number,
          dadWorkAddr: this.form.dad_workaddr,
          mumWorkAddr: this.form.mum_workaddr
        },
        transformRequest: [
          function(data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          }
        ]
      }).then(res => {
        if (res.data.code == -1) {
          this.alertTip(res.data.msg);
        } else if (res.data.code == 200) {
          this.alertTip("编辑成功");
          this.dialogFormVisible = false;
        }
      });
    },
    // 选择地区
    handleChange(value) {
      this.form.province = value[0]; //省id
      this.form.cityname = value[1]; //市id
      this.form.district = value[2]; //区id
    },
    uploadAvatar(response) {
      if (response.code == 200) {
        this.form.avatar =this.form.face= response.data;
      }
    },
    // 选择学年
    getPeriod: function(e) {
      this.form.xuenianid = e;
      this.getGrade();
    },
    // 儿童表单
    getChildform() {
      let data = Qs.stringify({
        token: localStorage.token,
        user_role: "child"
      });
      this.$axios({
        url: base.baseUrl + "/school/member/get-student-setting ",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.childData = res.data.data;
        }
      });
    },
    // 获取年级
    getGrade() {
      let data = Qs.stringify({
        attid: this.form.xuenianid
      });
      this.$axios({
        url: base.baseUrl + "/school/setting/get-class",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.grade_lists = res.data.data;
        }
      });
    },
    //============================================================================================================================
    // 获取回访记录
    getFile(uid, ischild) {
      this.dialogFormVisible2 = true;
      this.userid = uid;
      if (ischild == 1) {
        this.ifchild = true;
        this.getUserInfo();
        this.getRecord();
      } else {
        this.ifchild = false;
        this.getUserInfo();
        this.getRecord();
      }
      this.getAdultform();
      this.getChildform();
    },
    // 获取回访记录
    getRecord() {
      let data = Qs.stringify({
        token: localStorage.token,
        userid: this.userid
      });
      this.$axios({
        url: base.baseUrl + "/school/member/get-visit",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.gotRecord = res.data.data;
          this.loading3 = false;
        }
      });
    },
    //获取回访菜单(1级)
    getReturnMenu() {
      this.$axios({
        url: base.baseUrl + "/school/setting/get-visit-menu",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" }
      }).then(res => {
        if (res.data.code == 200) {
          this.returnMenu = res.data.data;
        }
      });
    },
    firstMenuChange: function(e) {
      this.firstMenu = e;
      this.getSecondMenu();
    },
    secondMenuChange(e) {
      this.secondMenu = e;
      this.getThirdMenu();
    },
    getSecondMenu() {
      let data = Qs.stringify({
        menuid: this.firstMenu
      });
      this.$axios({
        url: base.baseUrl + "/school/setting/get-visit-menu",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.returnMenu2 = res.data.data;
        }
      });
    },
    getThirdMenu() {
      let data = Qs.stringify({
        menuid: this.secondMenu
      });
      this.$axios({
        url: base.baseUrl + "/school/setting/get-visit-menu",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: data
      }).then(res => {
        if (res.data.code == 200) {
          this.returnMenu3 = res.data.data;
        }
      });
    },
    //添加回访记录
    addRecord(uid) {
      this.dialogFormVisible3 = true;
      this.getReturnMenu();
      this.userid = uid;
      this.getRecord();
    },
    submitRecord() {
      this.$axios({
        url: base.baseUrl + "/school/member/add-visit",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          token: localStorage.token,
          userid: this.userid,
          type_a: this.revisit,
          lev1: this.yiji,
          lev2: this.erji,
          lev3: this.sanji,
          type_d: this.reserveTime,
          content: this.returnResult
        },
        transformRequest: [
          function(data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          }
        ]
      }).then(res => {
        if (res.data.code == -1) {
          this.alertTip(res.data.msg);
        } else if (res.data.code == 200) {
          this.$alert("添加成功", "提示", {
            confirmButtonText: "确定",
            callback: action => {
              this.yiji = this.erji = this.sanji = this.reserveTime = this.returnResult =
                "";
            }
          });
          this.getRecord();
        }
      });
    },
    // 获取代理商设置的套餐列表
    getAgentPackageList() {
      this.$axios({
        url: base.baseUrl2 + "/v1/agent/agent-package/list",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          token: localStorage.token,
        //   token: "9f063cd31dd559824941e3d47fc69abc#100230",
          type: 1
        },
        transformRequest: [
          function(data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          }
        ]
      }).then(res => {
        if (res.data.status == 4000) {
          this.alertTip(res.data.message);
        } else if (res.data.status == 2000) {
          this.packageData[0].productType = res.data.data.productPackage;
          this.packageData[0].productType.push(res.data.data.otherPackage[0]);
          this.giftProduct[0].productType = this.packageData[0].productType;
        } else if (res.data.status == 2001) {
          this.$router.push("/login");
        }
      }).catch(error=>{
          console.log(error)
          this.alertTip("网络异常收银失败，请检查网络稍后再试")
      });
    },
    // 添加产品卡
    addProduct() {
      this.packageData.push(this.packageData[0]);
      this.purchaseForm.packageContains.push({
        payProductId: "",
        num: "",
        remark: "",
        payAmount: "",
        tradeType: 2015,
        otherType: false
      });
    },
    // 产品卡的选择
    selectGet() {
      // 产品套餐卡
      this.purchaseForm.packageContains.forEach(el => {
        if (el.payProductId == 99) {
          el.otherType = true;
        } else {
          el.otherType = false;
        }
      });
      // 随单赠送
      this.purchaseForm.giftCard.forEach(el => {
        if (el.payProductId == 99) {
          el.otherType = true;
        } else {
          el.otherType = false;
        }
        if(el.payProductId==''){
            el.num='';
            el.remark='';
            el.payAmount=''
        }
      });
    },
    // 删除产品卡
    removeProduct(index) {
      this.$confirm("是否确定删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.packageData.splice(index, 1);
        this.purchaseForm.packageContains.splice(index, 1);
      });
    },
    //余额购买提交事件
    submitPurchaseForm() {
      this.$refs.purchaseForm.validate(valid => {
        if (valid) {
          this.purchaseForm.packageContains.some(el => {
            if (el.num == "") {
              this.alertTip("产品卡数量不能为空");
              return true;
            }
            if(/^[0-9.]+$/.test(el.num)){
                el.num=Number(el.num).toString()
                if(el.num<=0){
                    this.alertTip('产品卡数量需要大于零');
                    return true;
                }
                if(!(/^[1-9]\d*$/.test(el.num))){
                    this.alertTip('产品卡数量输入格式有误');
                    return true;
                }
            }else{
                this.alertTip("产品卡数量输入格式有误");
                return true;
            }
            if (el.payProductId == "") {
              this.alertTip("产品卡类型不能为空");
              return true;
            }
            if(el.payProductId == 99){
                if(el.num==''){
                    this.alertTip("产品卡数量不能为空");
                    return true;
                };
                if(el.remark==''){
                    this.alertTip("产品名称不能为空");
                    return true;
                };
                if(el.payAmount==''){
                    this.alertTip("产品卡金额不能为空");
                    return true;
                };
                if(/^[0-9]+([.]{1}[0-9]+){0,1}$/.test(el.payAmount)){
                    el.payAmount=Number(el.payAmount).toString()
                    if(el.payAmount>0){
                        if(/^[0-9]+([.]{1}[0-9]{1,2}){0,1}$/.test(el.payAmount)){
                        }else{
                            this.alertTip('产品金额最小收款单位不能低于分')
                            return true
                        }
                    }else{
                        this.alertTip('输入金额需要大于零')
                        return true;
                    }
                }else{
                    this.alertTip('输入的金额格式有误')
                    return true;
                }
            }
            if((this.purchaseForm.giftCard[0].payProductId == ""&&this.purchaseForm.giftCard[0].num==''&&this.purchaseForm.giftCard[0].remark==''&&this.purchaseForm.giftCard[0].payAmount=='')||(this.purchaseForm.giftCard[0].payProductId != ""&&this.purchaseForm.giftCard[0].num!='')){
                if(this.purchaseForm.giftCard[0].payProductId != ""){
                    if(/^[0-9.]+$/.test(this.purchaseForm.giftCard[0].num)){
                        this.purchaseForm.giftCard[0].num=Number(this.purchaseForm.giftCard[0].num).toString()
                        if(this.purchaseForm.giftCard[0].num<=0){
                            this.alertTip('随单赠送的产品卡数量需要大于零');
                            return true;
                        }
                        if(!(/^[1-9]\d*$/.test(this.purchaseForm.giftCard[0].num))){
                            this.alertTip('随单赠送的产品卡数量输入格式有误');
                            return true;
                        }
                    }else{
                        this.alertTip("随单赠送的产品卡数量输入格式有误");
                        return true;
                    }
                }
                if(this.purchaseForm.giftCard[0].payProductId ==99){
                    if(/^[0-9.]+$/.test(this.purchaseForm.giftCard[0].num)){
                        this.purchaseForm.giftCard[0].num=Number(this.purchaseForm.giftCard[0].num).toString()
                        if(this.purchaseForm.giftCard[0].num<=0){
                            this.alertTip('随单赠送的产品卡数量需要大于零');
                            return true;
                        }
                        if(!(/^[1-9]\d*$/.test(this.purchaseForm.giftCard[0].num))){
                            this.alertTip('随单赠送的产品卡数量输入格式有误');
                            return true;
                        }
                    }else{
                        this.alertTip("随单赠送的产品卡数量输入格式有误");
                        return true;
                    }
                    if(/^[0-9]+([.]{1}[0-9]+){0,1}$/.test(this.purchaseForm.giftCard[0].payAmount)){
                        this.purchaseForm.giftCard[0].payAmount=Number(this.purchaseForm.giftCard[0].payAmount).toString()
                        if(this.purchaseForm.giftCard[0].payAmount>0){
                            if(/^[0-9]+([.]{1}[0-9]{1,2}){0,1}$/.test(this.purchaseForm.giftCard[0].payAmount)){
                            }else{
                                this.alertTip('产品金额最小收款单位不能低于分')
                                return true
                            }
                        }else{
                            this.alertTip('输入金额需要大于零')
                            return true;
                        }
                    }else{
                        this.alertTip('输入的金额格式有误')
                        return true;
                    }
            }
            
            }else{
                if(this.purchaseForm.giftCard[0].payProductId != ""){
                    if(this.purchaseForm.giftCard[0].num==''){
                        this.alertTip("随单赠送的产品卡数量不能为空")
                        return true
                    }
                }
                if(this.purchaseForm.giftCard[0].num != ""){
                    if(this.purchaseForm.giftCard[0].payProductId==''){
                        this.alertTip("随单赠送的产品类型不能为空")
                        return true
                    }
                }
            }
            if(this.purchaseForm.giftCard[0].payProductId ==99){
                if(this.purchaseForm.giftCard[0].num==''){
                    this.alertTip('随单赠送中的产品卡数量不能为空')
                    return true;
                }
                if(this.purchaseForm.giftCard[0].remark==''){
                    this.alertTip('随单赠送中的产品名称不能为空')
                    return true;
                }
                if(this.purchaseForm.giftCard[0].payAmount==''){
                    this.alertTip('随单赠送中的产品卡金额不能为空')
                    return true;
                }
            }
            this.$confirm("确定提交?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消"
            }).then(() => {
                var submitData={};
                this.btnPurchse=true
                this.loadingPurchase=true
                submitData.amount=this.purchaseForm.amount;
                submitData.memberId=this.purchaseForm.memberId;
                submitData.packageContains=[];
                this.purchaseForm.packageContains.forEach((el,index)=>{
                    submitData.packageContains.push({});
                    submitData.packageContains[index].num=el.num
                    submitData.packageContains[index].payAmount=el.payAmount
                    submitData.packageContains[index].payProductId=el.payProductId
                    submitData.packageContains[index].remark=el.remark
                    submitData.packageContains[index].tradeType=el.tradeType
                })
                if(this.purchaseForm.giftCard[0].payProductId!=''){
                    submitData.packageContains.push({});
                    submitData.packageContains[submitData.packageContains.length-1].num=this.purchaseForm.giftCard[0].num
                    submitData.packageContains[submitData.packageContains.length-1].payAmount=this.purchaseForm.giftCard[0].payAmount
                    submitData.packageContains[submitData.packageContains.length-1].payProductId=this.purchaseForm.giftCard[0].payProductId
                    submitData.packageContains[submitData.packageContains.length-1].remark=this.purchaseForm.giftCard[0].remark
                    submitData.packageContains[submitData.packageContains.length-1].tradeType=this.purchaseForm.giftCard[0].tradeType
                }
              submitData.token=localStorage.token
              submitData.packageContains = JSON.stringify(
                submitData.packageContains
              );
              this.$axios({
                url: base.baseUrl2 + "/v1/account/member-account/consume",
                method: "POST",
                header: { "content-type": "application/x-www-form-urlencoded" },
                data: submitData,
                transformRequest: [
                  function(data) {
                    let ret = "";
                    for (let it in data) {
                      ret +=
                        encodeURIComponent(it) +
                        "=" +
                        encodeURIComponent(data[it]) +
                        "&";
                    }
                    return ret;
                  }
                ]
              }).then(res => {
                  this.loadingPurchase=false
                this.btnPurchse=false
                if (res.data.status == 4000) {
                  this.alertTip(res.data.message);
                } else if (res.data.status == 2000) {
                    this.getStudentProduct();
                    this.getProductHistory();
                    this.getCashFlow();
                    this.getBalanceFlow();
                    this.getStudentBalance(this.purchaseForm.account)
                  this.$alert(res.data.data, "提示", {
                    confirmButtonText: "确定",
                    callback: action => {
                      this.dialogVisible = false;
                    }
                  }); 
                } else if (res.data.status == 2001) {
                  this.$router.push("/login");
                }
              }).catch(error=>{
                this.loadingPurchase=false
                this.btnPurchse=false
                console.log(error)
                this.alertTip("网络异常收银失败，请检查网络稍后再试")
                });
            });
          });
        } else {
          this.alertTip("选项有误,不能提交");
        }
      });
    },
    alertTip(msg) {
      this.$alert(msg, "提示", {
        confirmButtonText: "确定"
        // callback: action => {
        //     this.$message({
        //         type: 'info',
        //     });
        // }
      });
    },
    getStatus() {
      this.$axios({
        url: base.baseUrl + "/school/member/get-member-status-list",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          token: localStorage.token
        },
        transformRequest: [
          function(data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          }
        ]
      }).then(res => {
        if (res.data.code == 200) {
          this.status = res.data.data;
        } else if (res.data.code == -2) {
          this.$router.push("/login");
        }
      });
    },
    getAgents() {
      this.$axios({
        url: base.baseUrl + "/school/agent/get-agent-list",
        method: "POST",
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          token: localStorage.token
        },
        transformRequest: [
          function(data) {
            let ret = "";
            for (let it in data) {
              ret +=
                encodeURIComponent(it) +
                "=" +
                encodeURIComponent(data[it]) +
                "&";
            }
            return ret;
          }
        ]
      }).then(res => {
        if (res.data.code == 200) {
          this.agents = res.data.data;
        } else if (res.data.code == -2) {
          this.$router.push("/login");
        }
      });
    },
    ifShowxianxia() {
      if (
        localStorage.roleid == 10 ||
        localStorage.roleid == 12 ||
        localStorage.roleid == 13 ||
        localStorage.roleid == 14 ||
        localStorage.roleid == 15
      ) {
        this.xxSelect = true;
      }
    },
     // 重置表单数据
    resetForm(formName) {
      this.$refs[formName].resetFields();
       this.packageData.splice(1);
       this.purchaseForm.packageContains.splice(0);
      this.purchaseForm.packageContains.push({
        payProductId: '',
        num: "",
        remark: "",
        payAmount: "",
        tradeType: 2015,
        otherType: false
      });
      this.purchaseForm.giftCard=[]
       this.purchaseForm.giftCard.push({
            payProductId: '',
            num: "",
            remark: "",
            payAmount: "",
            tradeType: 2017,
            otherType: false
          });
    }
  },
  filters: {
    transData(time) {
      return formatDate(new Date(time * 1000), "yyyy-MM-dd hh:mm");
    },
    transData2(time) {
      return formatDate(new Date(time * 1000), "yyyy-MM-dd");
    },
    filterStatu(type) {
      switch (type) {
        case "1":
          return "编辑延期";
          break;
        case "2":
          return "发送延期";
          break;
        case "3":
          return "审核通过";
          break;
        case "4":
          return "审核失败";
          break;
      }
    },
    transOverData(time) {
      return "现有效期:" + formatDate(new Date(time * 1000), "yyyy-MM-dd");
    },
    judgeStatus(status) {
      if (status == 0) {
        return "未激活";
      } else if (status == 1) {
        return "已激活";
      } else if (status == 2) {
        return "已失效";
      }
    }
  },
  created() {
    this.getData();
    this.getStatus();
    this.getAgents();
    this.ifShowxianxia();
    var size=parseInt(this.tableHeight2/36)-1
    this.balanceSize=size>9?9:size
  },
};
</script>
<style lang="less" scoped>
@media screen and (max-width: 1700px) {
  .el-form--inline {
    width: 1400px;
  }
  .smbtn {
    width: 160px !important;
  }
}
@media screen and (max-width: 1460px) {
  .smbtn {
    width: 132px !important;
  }
  .search_btn {
    width: 80px !important;
  }
  .reset_btn {
    width: 100px !important;
  }
  .operate_inputs {
    padding: 15px 0 !important;
  }
}
.avatar {
    width: 150px;
    height: 150px;
    display: block;
}
.operate_inputs {
  padding: 15px 30px;
  height: 70px;
  box-sizing: border-box;
  button {
    width: 130px;
    height: 38px;
    border-radius: 4px;
    border: none;
  }
  .search_btn {
    background-color: #ff5263;
  }
  .reset_btn {
    background-color: #808080;
  }
}
.page_block {
  position: absolute;
  margin-top: 12px;
  right: 5%;
}
.balancePage{
    margin-top: 12px;
    float: right
}
.recordStyle {
  width: 100%;
  text-align: center;
  margin: 10px 0 30px 40px;
}
.centerTitle {
  text-align: center;
  font-size: 14px;
  color: #909399;
  line-height: 40px;
}
.giftText {
  float: right;
  margin-top: -30px;
  margin-right: 50px;
  color: #aaa;
}
.addBtnBox {
  text-align: right;
}
.box-card {
  margin-top: 10px;
}
#closeIcon {
  position: relative;
  left: 96%;
  font-size: 22px;
}
</style>


